home *** CD-ROM | disk | FTP | other *** search
-
- #pragma once
-
- #include <LApplication.h>
-
- #include "NetSprocket.h"
- #include <LArray.h>
- #include <LComparator.h>
- #include <LWindow.h>
-
- typedef struct TKeyState
- {
- NSpMessageHeader h;
- UInt32 keyMap[4];
- UInt32 pulseBit;
- } TKeyState;
-
- typedef struct OptionsMessage
- {
- NSpMessageHeader header;
- UInt32 priority;
- UInt32 rate;
- UInt32 size;
- } OptionsMessage;
- UInt32 gPulseBit;
-
- typedef struct PlayerListItem
- {
- NSpPlayerID player;
- LWindow *window;
- } PlayerListItem;
-
- class CPlayerListComparator : LComparator
- {
- public:
- CPlayerListComparator() {}
- ~CPlayerListComparator() {}
- virtual Int32 Compare(
- const void* inItemOne,
- const void* inItemTwo,
- Uint32 inSizeOne,
- Uint32 inSizeTwo) const;
-
- virtual Boolean IsEqualTo(
- const void* inItemOne,
- const void* inItemTwo,
- Uint32 inSizeOne,
- Uint32 inSizeTwo) const;
- virtual Int32 CompareToKey(
- const void* inItem,
- Uint32 inSize,
- const void* inKey) const;
-
- virtual Boolean IsEqualToKey(
- const void* inItem,
- Uint32 inSize,
- const void* inKey) const;
-
-
- };
-
-
- class NSTestApp : public LApplication {
- public:
- NSTestApp(); // constructor registers all PPobs
- virtual ~NSTestApp(); // stub destructor
-
- // this overriding function performs application functions
-
- virtual void ProcessNextEvent(void);
- virtual Boolean ObeyCommand(CommandT inCommand, void* ioParam);
-
- // this overriding function returns the status of menu items
-
- virtual void FindCommandStatus(CommandT inCommand,
- Boolean &outEnabled, Boolean &outUsesMark,
- Char16 &outMark, Str255 outName);
- protected:
-
- virtual void StartUp(); // overriding startup functions
- void HandleGameEvent(NSpMessageHeader *inEvent);
- void HandlePlayerJoined(NSpPlayerJoinedMessage *inEvent);
- void HandlePlayerLeft(NSpPlayerLeftMessage *inEvent);
- void HandleGameStart(NSpMessageHeader *inEvent);
- void HandleGamePause(NSpMessageHeader *inEvent);
- void HandleGameEnd(NSpMessageHeader *inEvent);
- void HandleGameTerminated(NSpGameTerminatedMessage *inMessage);
- void HandleTestGroups(NSpMessageHeader *inEvent);
- void HandleKeyboardState(TKeyState *inEvent);
- void HandleResyncMessage(TKeyState *inEvent);
- void HandlePropogateOptions(OptionsMessage *inEvent);
-
- void DoHost(void);
- void DoJoin(void);
- void DoGetGroups(void);
- void DoGetPlayers(void);
- void DoTestGroups(void);
- void DoUnadvertise(void);
- void DoStartGame(void);
- void DoGameEnd(void);
- virtual void DoKillGame(void);
- void DoResetOptions(void);
- void DoPropogateOptions(void);
- void DoSendResyncMessage(void);
-
- NSpGameReference theGame;
- Boolean bAdvertising;
- Boolean bHost;
- Boolean bRunning;
- NSpPlayerID mPlayerID;
- LArray *mPlayerList;
-
- };